---
title: Chat models
---

[Chat models](/oss/langchain/models) are language models that use a sequence of [messages](/oss/langchain/messages) as inputs and return messages as outputs (as opposed to using plain text). These are generally newer models.

<Info>
If you'd like to write your own chat model, see [this how-to](/oss/how-to/custom_chat). If you'd like to contribute an integration, see [Contributing integrations](/oss/contributing#add-a-new-integration).
</Info>

<Tabs>
<Tab title="Groq">

#### Install dependencies

<Tip>
See [this section for general instructions on installing integration packages](/docs/how_to/installation/#installing-integration-packages).
</Tip>

<Tabs>
<Tab title="npm">

```bash
npm i @langchain/groq
```

</Tab>
<Tab title="yarn">

```bash
yarn add @langchain/groq
```

</Tab>
<Tab title="pnpm">

```bash
pnpm add @langchain/groq
```

</Tab>
</Tabs>

#### Add environment variables

```bash
GROQ_API_KEY=your-api-key
```

#### Instantiate the model

```typescript
import { ChatGroq } from "@langchain/groq";

const model = new ChatGroq({
  model: "llama-3.3-70b-versatile",
  temperature: 0
});
```

</Tab>
<Tab title="OpenAI">

#### Install dependencies

<Tip>
See [this section for general instructions on installing integration packages](/docs/how_to/installation/#installing-integration-packages).
</Tip>

<Tabs>
<Tab title="npm">

```bash
npm i @langchain/openai
```

</Tab>
<Tab title="yarn">

```bash
yarn add @langchain/openai
```

</Tab>
<Tab title="pnpm">

```bash
pnpm add @langchain/openai
```

</Tab>
</Tabs>

#### Add environment variables

```bash
OPENAI_API_KEY=your-api-key
```

#### Instantiate the model

```typescript
import { ChatOpenAI } from "@langchain/openai";

const model = new ChatOpenAI({ model: "gpt-4o-mini" });
```

</Tab>
<Tab title="Anthropic">

#### Install dependencies

<Tip>
See [this section for general instructions on installing integration packages](/docs/how_to/installation/#installing-integration-packages).
</Tip>

<Tabs>
<Tab title="npm">

```bash
npm i @langchain/anthropic
```

</Tab>
<Tab title="yarn">

```bash
yarn add @langchain/anthropic
```

</Tab>
<Tab title="pnpm">

```bash
pnpm add @langchain/anthropic
```

</Tab>
</Tabs>

#### Add environment variables

```bash
ANTHROPIC_API_KEY=your-api-key
```

#### Instantiate the model

```typescript
import { ChatAnthropic } from "@langchain/anthropic";

const model = new ChatAnthropic({
  model: "claude-3-sonnet-20240620",
  temperature: 0
});
```

</Tab>
<Tab title="Google Gemini">

#### Install dependencies

<Tip>
See [this section for general instructions on installing integration packages](/docs/how_to/installation/#installing-integration-packages).
</Tip>

<Tabs>
<Tab title="npm">

```bash
npm i @langchain/google-genai
```

</Tab>
<Tab title="yarn">

```bash
yarn add @langchain/google-genai
```

</Tab>
<Tab title="pnpm">

```bash
pnpm add @langchain/google-genai
```

</Tab>
</Tabs>

#### Add environment variables

```bash
GOOGLE_API_KEY=your-api-key
```

#### Instantiate the model

```typescript
import { ChatGoogleGenerativeAI } from "@langchain/google-genai";

const model = new ChatGoogleGenerativeAI({
  modelName: "gemini-2.0-flash",
  temperature: 0
});
```

</Tab>
<Tab title="FireworksAI">

#### Install dependencies

<Tip>
See [this section for general instructions on installing integration packages](/docs/how_to/installation/#installing-integration-packages).
</Tip>

<Tabs>
<Tab title="npm">

```bash
npm i @langchain/community
```

</Tab>
<Tab title="yarn">

```bash
yarn add @langchain/community
```

</Tab>
<Tab title="pnpm">

```bash
pnpm add @langchain/community
```

</Tab>
</Tabs>

#### Add environment variables

```bash
FIREWORKS_API_KEY=your-api-key
```

#### Instantiate the model

```typescript
import { ChatFireworks } from "@langchain/community/chat_models/fireworks";

const model = new ChatFireworks({
  model: "accounts/fireworks/models/llama-v3p1-70b-instruct",
  temperature: 0
});
```

</Tab>
<Tab title="MistralAI">

#### Install dependencies

<Tip>
See [this section for general instructions on installing integration packages](/docs/how_to/installation/#installing-integration-packages).
</Tip>

<Tabs>
<Tab title="npm">

```bash
npm i @langchain/mistralai
```

</Tab>
<Tab title="yarn">

```bash
yarn add @langchain/mistralai
```

</Tab>
<Tab title="pnpm">

```bash
pnpm add @langchain/mistralai
```

</Tab>
</Tabs>

#### Add environment variables

```bash
MISTRAL_API_KEY=your-api-key
```

#### Instantiate the model

```typescript
import { ChatMistralAI } from "@langchain/mistralai";

const model = new ChatMistralAI({
  model: "mistral-large-latest",
  temperature: 0
});
```

</Tab>
<Tab title="VertexAI">

#### Install dependencies

<Tip>
See [this section for general instructions on installing integration packages](/docs/how_to/installation/#installing-integration-packages).
</Tip>

<Tabs>
<Tab title="npm">

```bash
npm i @langchain/google-vertexai
```

</Tab>
<Tab title="yarn">

```bash
yarn add @langchain/google-vertexai
```

</Tab>
<Tab title="pnpm">

```bash
pnpm add @langchain/google-vertexai
```

</Tab>
</Tabs>

#### Add environment variables

```bash
GOOGLE_APPLICATION_CREDENTIALS=credentials.json
```

#### Instantiate the model

```typescript
import { ChatVertexAI } from "@langchain/google-vertexai";

const model = new ChatVertexAI({
  model: "gemini-1.5-flash",
  temperature: 0
});
```

</Tab>
</Tabs>

```javascript
await model.invoke("Hello, world!")
```

## Featured providers

| Model                                                                    | Stream | JSON mode | [Tool Calling](/oss/langchain/tools/) | [`withStructuredOutput()`](/oss/langchain/structured-output#the-.withstructuredoutput-method) | [Multimodal](/oss/how-to/multimodal_inputs/) |
| :----------------------------------------------------------------------- | :----: | :-------: | :----------------------------------------: | :------------------------------------------------------------------------------------------: | :-------------------------------------------: |
| [BedrockChat](/oss/integrations/chat/bedrock/)                          |   ✅   |    ❌     |        🟡 (Bedrock Anthropic only)         |                                 🟡 (Bedrock Anthropic only)                                  |          🟡 (Bedrock Anthropic only)          |
| [ChatBedrockConverse](/oss/integrations/chat/bedrock_converse/)         |   ✅   |    ❌     |                     ✅                     |                                              ✅                                              |                      ✅                       |
| [ChatAnthropic](/oss/integrations/chat/anthropic/)                      |   ✅   |    ❌     |                     ✅                     |                                              ✅                                              |                      ✅                       |
| [ChatCloudflareWorkersAI](/oss/integrations/chat/cloudflare_workersai/) |   ✅   |    ❌     |                     ❌                     |                                              ❌                                              |                      ❌                       |
| [ChatCohere](/oss/integrations/chat/cohere/)                            |   ✅   |    ❌     |                     ✅                     |                                              ✅                                              |                      ✅                       |
| [ChatFireworks](/oss/integrations/chat/fireworks/)                      |   ✅   |    ✅     |                     ✅                     |                                              ✅                                              |                      ✅                       |
| [ChatGoogleGenerativeAI](/oss/integrations/chat/google_generative_ai/)   |   ✅   |    ❌     |                     ✅                     |                                              ✅                                              |                      ✅                       |
| [ChatVertexAI](/oss/integrations/chat/google_vertex_ai/)                |   ✅   |    ❌     |                     ✅                     |                                              ✅                                              |                      ✅                       |
| [ChatGroq](/oss/integrations/chat/groq/)                                |   ✅   |    ✅     |                     ✅                     |                                              ✅                                              |                      ✅                       |
| [ChatMistralAI](/oss/integrations/chat/mistral/)                        |   ✅   |    ✅     |                     ✅                     |                                              ✅                                              |                      ✅                       |
| [ChatOllama](/oss/integrations/chat/ollama/)                            |   ✅   |    ✅     |                     ✅                     |                                              ✅                                              |                      ✅                       |
| [ChatOpenAI](/oss/integrations/chat/openai/)                            |   ✅   |    ✅     |                     ✅                     |                                              ✅                                              |                      ✅                       |
| [ChatTogetherAI](/oss/integrations/chat/togetherai/)                    |   ✅   |    ✅     |                     ✅                     |                                              ✅                                              |                      ✅                       |
| [ChatXAI](/oss/integrations/chat/xai/)                                  |   ✅   |    ✅     |                     ✅                     |                                              ✅                                              |                      ❌                       |

## All chat models

<Columns cols={3}>
  <Card
    title="Alibaba Tongyi"
    icon="link"
    href="/oss/integrations/chat/alibaba_tongyi"
    arrow="true"
    cta="View guide"
  >
  </Card>
  <Card
    title="Anthropic"
    icon="link"
    href="/oss/integrations/chat/anthropic"
    arrow="true"
    cta="View guide"
  >
  </Card>
  <Card
    title="Arcjet Redact"
    icon="link"
    href="/oss/integrations/chat/arcjet"
    arrow="true"
    cta="View guide"
  >
  </Card>
  <Card
    title="Azure OpenAI"
    icon="link"
    href="/oss/integrations/chat/azure"
    arrow="true"
    cta="View guide"
  >
  </Card>
  <Card
    title="Baidu Qianfan"
    icon="link"
    href="/oss/integrations/chat/baidu_qianfan"
    arrow="true"
    cta="View guide"
  >
  </Card>
  <Card
    title="Amazon Bedrock"
    icon="link"
    href="/oss/integrations/chat/bedrock"
    arrow="true"
    cta="View guide"
  >
  </Card>
  <Card
    title="Amazon Bedrock Converse"
    icon="link"
    href="/oss/integrations/chat/bedrock_converse"
    arrow="true"
    cta="View guide"
  >
  </Card>
  <Card
    title="Cerebras"
    icon="link"
    href="/oss/integrations/chat/cerebras"
    arrow="true"
    cta="View guide"
  >
  </Card>
  <Card
    title="Cloudflare Workers AI"
    icon="link"
    href="/oss/integrations/chat/cloudflare_workersai"
    arrow="true"
    cta="View guide"
  >
  </Card>
  <Card
    title="Cohere"
    icon="link"
    href="/oss/integrations/chat/cohere"
    arrow="true"
    cta="View guide"
  >
  </Card>
  <Card
    title="Deep Infra"
    icon="link"
    href="/oss/integrations/chat/deep_infra"
    arrow="true"
    cta="View guide"
  >
  </Card>
  <Card
    title="DeepSeek"
    icon="link"
    href="/oss/integrations/chat/deepseek"
    arrow="true"
    cta="View guide"
  >
  </Card>
  <Card
    title="Fake LLM"
    icon="link"
    href="/oss/integrations/chat/fake"
    arrow="true"
    cta="View guide"
  >
  </Card>
  <Card
    title="Fireworks"
    icon="link"
    href="/oss/integrations/chat/fireworks"
    arrow="true"
    cta="View guide"
  >
  </Card>
  <Card
    title="Friendli"
    icon="link"
    href="/oss/integrations/chat/friendli"
    arrow="true"
    cta="View guide"
  >
  </Card>
  <Card
    title="Google GenAI"
    icon="link"
    href="/oss/integrations/chat/google_generative_ai"
    arrow="true"
    cta="View guide"
  >
  </Card>
  <Card
    title="Google Vertex AI"
    icon="link"
    href="/oss/integrations/chat/google_vertex_ai"
    arrow="true"
    cta="View guide"
  >
  </Card>
  <Card
    title="Groq"
    icon="link"
    href="/oss/integrations/chat/groq"
    arrow="true"
    cta="View guide"
  >
  </Card>
  <Card
    title="IBM watsonx.ai"
    icon="link"
    href="/oss/integrations/chat/ibm"
    arrow="true"
    cta="View guide"
  >
  </Card>
  <Card
    title="Llama CPP"
    icon="link"
    href="/oss/integrations/chat/llama_cpp"
    arrow="true"
    cta="View guide"
  >
  </Card>
  <Card
    title="Minimax"
    icon="link"
    href="/oss/integrations/chat/minimax"
    arrow="true"
    cta="View guide"
  >
  </Card>
  <Card
    title="MistralAI"
    icon="link"
    href="/oss/integrations/chat/mistral"
    arrow="true"
    cta="View guide"
  >
  </Card>
  <Card
    title="Moonshot"
    icon="link"
    href="/oss/integrations/chat/moonshot"
    arrow="true"
    cta="View guide"
  >
  </Card>
  <Card
    title="Novita AI"
    icon="link"
    href="/oss/integrations/chat/novita"
    arrow="true"
    cta="View guide"
  >
  </Card>
  <Card
    title="Ollama"
    icon="link"
    href="/oss/integrations/chat/ollama"
    arrow="true"
    cta="View guide"
  >
  </Card>
  <Card
    title="OpenAI"
    icon="link"
    href="/oss/integrations/chat/openai"
    arrow="true"
    cta="View guide"
  >
  </Card>
  <Card
    title="Perplexity"
    icon="link"
    href="/oss/integrations/chat/perplexity"
    arrow="true"
    cta="View guide"
  >
  </Card>
  <Card
    title="PremAI"
    icon="link"
    href="/oss/integrations/chat/premai"
    arrow="true"
    cta="View guide"
  >
  </Card>
  <Card
    title="Tencent Hunyuan"
    icon="link"
    href="/oss/integrations/chat/tencent_hunyuan"
    arrow="true"
    cta="View guide"
  >
  </Card>
  <Card
    title="Together"
    icon="link"
    href="/oss/integrations/chat/togetherai"
    arrow="true"
    cta="View guide"
  >
  </Card>
  <Card
    title="WebLLM"
    icon="link"
    href="/oss/integrations/chat/web_llm"
    arrow="true"
    cta="View guide"
  >
  </Card>
  <Card
    title="xAI"
    icon="link"
    href="/oss/integrations/chat/xai"
    arrow="true"
    cta="View guide"
  >
  </Card>
  <Card
    title="YandexGPT"
    icon="link"
    href="/oss/integrations/chat/yandex"
    arrow="true"
    cta="View guide"
  >
  </Card>
  <Card
    title="ZhipuAI"
    icon="link"
    href="/oss/integrations/chat/zhipuai"
    arrow="true"
    cta="View guide"
  >
  </Card>
</Columns>
